// import puppeteer from 'puppeteer';
import AbstractCrawler from '../mediaPlatform/kwai/core';
import CrawlerFactory from '../core/CrawlerFactory';
/**
 * 开始
 * @param path
 */
export const handlerCrawler = () => {
  start("");
};

export const handlerSave = () => {
  if (crawler) {
    crawler.saveCookie();
  }
};

let crawler: AbstractCrawler;

const start = (path: string) => {
  console.log(path);
  
  crawler = CrawlerFactory.createCrawler('ks');
  // 代理
  // if () {

  // }
  crawler.initConfig('qrcode');
  crawler.start();
  // const browser = await puppeteer.launch({headless: false});
  // const page = await browser.newPage();
  // await page.setUserAgent(userAgent);

  // await page.goto('https://www.kuaishou.com/short-video/3xsgn4pjbpgk8yu?authorId=3xnbmb2reg8nrtm&streamSource=profile&area=profilexxnull');
  // //Set screen size
  // await page.setViewport({width: 1920, height: 1024});
}
